using UnityEngine;

namespace UndergroundSurvival.Core
{
    public class GameManager : MonoBehaviour
    {
        public static GameManager Instance { get; private set; }

        [Header("Game Settings")]
        public float gameSpeed = 1f;
        public bool isPaused = false;

        private void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
                DontDestroyOnLoad(gameObject);
            }
            else
            {
                Destroy(gameObject);
            }
        }

        private void Start()
        {
            InitializeGame();
        }

        private void InitializeGame()
        {
            // 初始化游戏系统
            Debug.Log("Game Initializing...");
        }

        public void PauseGame()
        {
            isPaused = true;
            Time.timeScale = 0f;
        }

        public void ResumeGame()
        {
            isPaused = false;
            Time.timeScale = gameSpeed;
        }

        public void SetGameSpeed(float speed)
        {
            gameSpeed = speed;
            if (!isPaused)
            {
                Time.timeScale = speed;
            }
        }
    }
} 